package practice;

public class PracticeDay2 {
    public static void main(String[] args) {
        //1.1
        int a;
        int b,c,d;
        //1.2
        int e = 0;
        int f;
        f = 0;
        //1.3
        int g = 0;
        int h = g+10;
        System.out.println(h);
        //1.4
        g = g+10;
        System.out.println(g);
        //1.5
        int a_1,a_$2,a0;
        //int a*b;//编译错误，不能包含*号等特殊符号
        //ing 1a;//编译错误，变量名不能以数字开头
        int aa = 5;
        //System.out.println(aA);//编译错误，严格区分大小写
        //int class;//变量名不能使用关键字
        int k;//不直观
        int 年龄;//不建议使用中文
        int nianling;//杜绝拼音
        int age;//见名知意
        int score,myScore,myJavaScore;//小驼峰命名

        //2.1
        int a1 = 5;
        int a2 = 2;
        System.out.println(a1/a2);
        //2.2
        int a3 = 2147483647;
        int a4 = 1;
        System.out.println(a3+a4);//结果溢出

        //3.1
        long b1 = 0L;
        long b2 = 0L;
        //3.2
        long b3 = 100000000000L;//100亿L为长整型直接量
        long b4 = 1000000000*2*10L;
        System.out.println(b4);//200亿
        long b5 = 1000000000*3*10L;
        System.out.println(b5);//不是300亿
        long b6 = 1000000000L*3*10;//运算如果会有溢出建议在第一个数字后加L
        System.out.println(b6);//300亿

        //4.1
        double e1 = 3.14;
        double e2 = 3.14;
        //4.2
        double e3 = 3.9,e4 = 4.0;
        System.out.println(e4-e3);//0.10000000000000009，有可能出现舍入误差

        //5.1
        boolean f1 = true;//true为布尔型直接量
        boolean f2 = false;//false为布尔型直接量
        //boolean f3 = 25;//编译错误，布尔型只能赋值为true或false

        //6.1
        char q1 = 'a';
        char q2 = '男';
        char q3 = '1';
        char q4 = '*';
        char q5 = ' ';
        //6.2
        char q6 = '\\';
        System.out.println(q6);//\

        //7.1
        int z1 = 5;
        long z2 = z1;//自动类型转换
        int z3 = (int)z2;//强制类型转换
        //7.2
        long z4 = 10000000000000L;
        int z5 = (int)z4;
        System.out.println(z5);//强转有可能发生溢出
        //7.3
        double z6 = 23.456;
        int z7 = (int)z6;
        System.out.println(z7);//强转可能丢失精度

        //8.1
        byte v1 = 5;
        byte v2 = 6;
        byte v3 = (byte) (v1+v2);//byte,short,char在做运算时会自动转为int类型，先运算后强转

        System.out.println(2+2);
        System.out.println(2+'2');
        System.out.println('2'+'2');







    }
}
